Docker : Install
2014/06/16 |
Install Docker which is the LXC (Linux Containers) based Container Tool.
|
|
[1] | Install Docker |
root@dlp:~#
root@dlp:~# apt-get -y install docker.io ln -s /usr/bin/docker.io /usr/bin/docker
|
[2] | Download the ubuntu official image and create a Container and output the words "Welcome to the Docker World" from the Container. |
# download the "ubuntu" image root@dlp:~# docker pull ubuntu
# execute echo from the Container root@dlp:~# docker run ubuntu /bin/echo "Welcome to the Docker World!" Welcome to the Docker World! |
[3] | Connect to the interactive session of a Container with "i" and "t" option like follows. If exit from the Container session, the process of a Container finishs. |
root@dlp:~#
root@967cdf700a39:/# docker run -i -t ubuntu /bin/bash root@8ca23c655c05:/# # Container's console exit exit root@dlp:~# # just be back |
[4] | If exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key. |
root@dlp:~#
docker run -i -t ubuntu /bin/bash root@00cc6c8edf1b:/# root@dlp:~# # Ctrl+p, Ctrl+q key to back to Host's console # show docker process root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f4421c9a3182 ubuntu:14.04 /bin/bash 4 minutes ago Up 4 minutes kickass_davinci # connect to container's session root@dlp:~# docker attach f4421c9a3182 root@f4421c9a3182:/# # shutdown container's process from Host's console root@dlp:~# docker kill f4421c9a3182 f4421c9a3182 root@dlp:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |